﻿<?php
    session_start();
    if($_SESSION['sjh'] && $_SESSION['login'] == 1)
    {
        if($_SESSION['yhm'])echo $_SESSION['yhm'];
        else echo $_SESSION['sjh'];
        echo '|Anters|';
        
        require ('quanju.php');
        $tcxh = 0;
        while ($tcxh == 0) {
            $tcxh = 1;
            $jkm = rand(0, $jkmGS - 1);
            $result = $conn->query("SELECT * FROM hg002 WHERE jkm='" . $jkm . "'");
            if ($result){
                while ($row = mysqli_fetch_array($result)) {
                    $sj = intval($row['jkmsj']);
                    if (time() - $sj <= 60 * 5){
                        $tcxh = 0;
                        continue;
                    }
                }
            }
        }
        $_SESSION['jkm'] = $jkm;
        $sj = time();
        if ($conn->query("UPDATE hg002 SET jkm='" . $jkm . "',jkmsj='" . $sj .
            "' WHERE sjh='" . $_SESSION['sjh'] . "'")) {
        }
        $conn->close();
        if($jkm % 10 == 9) echo 10 * ($jkm - $jkm % 10 + 10) + 10;
        else echo $jkm + 11;
    }
    exit;
?>